/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ImprimirPlanillaLlamado.java
 *
 * Created on 21-ene-2013, 15:08:52
 */
package gui;

import com.sun.awt.AWTUtilities;
import controladores.ControladorPrincipal;
import java.awt.Image;
import java.awt.Shape;
import java.awt.geom.RoundRectangle2D;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;
import utilidades.JFrameConFondo;

/**
 *
 * @author NiCo
 */
public class EstadisticaOtrosDatos extends JFrameConFondo {

    private Image icono = new ImageIcon(getClass().getResource("/imagenes/logo.png")).getImage();
    private ArrayList<Integer> estadistica = null;

    /** Creates new form ImprimirPlanillaLlamado */
    public EstadisticaOtrosDatos() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        btnCerrar = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        rbtnCasos = new javax.swing.JRadioButton();
        rbtnMotivos = new javax.swing.JRadioButton();
        rbtnSexo = new javax.swing.JRadioButton();
        rbtnZona = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        dtpAnio3 = new com.toedter.calendar.JYearChooser();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cerrar-normal.png"))); // NOI18N
        btnCerrar.setBorder(null);
        btnCerrar.setBorderPainted(false);
        btnCerrar.setFocusPainted(false);
        btnCerrar.setName("btnCerrar"); // NOI18N
        btnCerrar.setOpaque(false);
        btnCerrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btnCerrarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btnCerrarMouseExited(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                btnCerrarMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                btnCerrarMouseReleased(evt);
            }
        });
        btnCerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrarActionPerformed(evt);
            }
        });

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/titulo-estadistica-casos.png"))); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/ver-reporte.png"))); // NOI18N
        jButton1.setBorderPainted(false);
        jButton1.setFocusPainted(false);
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tipo de informe", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        buttonGroup1.add(rbtnCasos);
        rbtnCasos.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        rbtnCasos.setText("Casos");
        rbtnCasos.setName("rbtnCasos"); // NOI18N

        buttonGroup1.add(rbtnMotivos);
        rbtnMotivos.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        rbtnMotivos.setText("Motivo");
        rbtnMotivos.setName("rbtnMotivos"); // NOI18N

        buttonGroup1.add(rbtnSexo);
        rbtnSexo.setFont(new java.awt.Font("Tahoma", 0, 12));
        rbtnSexo.setText("Sexo");
        rbtnSexo.setName("rbtnSexo"); // NOI18N

        buttonGroup1.add(rbtnZona);
        rbtnZona.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        rbtnZona.setText("Zona");
        rbtnZona.setName("rbtnZona"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbtnCasos)
                    .addComponent(rbtnMotivos)
                    .addComponent(rbtnSexo)
                    .addComponent(rbtnZona))
                .addContainerGap(250, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rbtnCasos)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rbtnMotivos)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rbtnSexo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rbtnZona)
                .addContainerGap(4, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos requeridos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        dtpAnio3.setName("dtpAnio3"); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel1.setText("Año");
        jLabel1.setName("jLabel1"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(dtpAnio3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(184, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(dtpAnio3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(109, 109, 109)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
                .addComponent(btnCerrar)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(7, 7, 7))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(105, Short.MAX_VALUE)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(99, 99, 99))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnCerrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCerrarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMouseEntered

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-activo.png")));     }//GEN-LAST:event_btnCerrarMouseEntered

    private void btnCerrarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMouseExited

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-normal.png")));     }//GEN-LAST:event_btnCerrarMouseExited

    private void btnCerrarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMousePressed

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-click.png")));     }//GEN-LAST:event_btnCerrarMousePressed

    private void btnCerrarMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMouseReleased

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-normal.png")));     }//GEN-LAST:event_btnCerrarMouseReleased

    private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnCerrarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        List<Object[]> valores = null;
        if (rbtnCasos.isSelected() && dtpAnio3.getYear() != -1) {
            valores = ControladorPrincipal.getInstance().getControladorEstadisticas().casoAnual(dtpAnio3.getYear());
            if (valores != null) {
                gui.reportes.OtrosDatos frm = new gui.reportes.OtrosDatos(valores, dtpAnio3.getYear(), "Casos por mes");
                frm.setLocationRelativeTo(null);
                frm.setIconImage(icono);
                frm.setImagen("/imagenes/fondo.png");
                frm.setVisible(true);
                Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                AWTUtilities.setWindowShape(frm, shape);
            } else {
                MensajesInfo p1 = new MensajesInfo('n', "NoCasoA");
                p1.setLocationRelativeTo(null);
                p1.setIconImage(icono);
                p1.setVisible(true);
                Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                AWTUtilities.setWindowShape(p1, shape);
            }
        } else {
            if (rbtnMotivos.isSelected() && dtpAnio3.getYear() != -1) {
                valores = ControladorPrincipal.getInstance().getControladorEstadisticas().casoMotivoAnual(dtpAnio3.getYear());
                if (valores != null) {
                    gui.reportes.OtrosDatos frm = new gui.reportes.OtrosDatos(valores, dtpAnio3.getYear(), "Casos por motivo");
                    frm.setLocationRelativeTo(null);
                    frm.setIconImage(icono);
                    frm.setImagen("/imagenes/fondo.png");
                    frm.setVisible(true);
                    Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                    AWTUtilities.setWindowShape(frm, shape);
                } else {
                    MensajesInfo p1 = new MensajesInfo('n', "NoCasoA");
                    p1.setLocationRelativeTo(null);
                    p1.setIconImage(icono);
                    p1.setVisible(true);
                    Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                    AWTUtilities.setWindowShape(p1, shape);
                }
            } else {
                if (rbtnSexo.isSelected() && dtpAnio3.getYear() != -1) {
                    valores = ControladorPrincipal.getInstance().getControladorEstadisticas().casoSexoAnual(dtpAnio3.getYear());
                        if (valores != null) {
                            gui.reportes.OtrosDatos frm = new gui.reportes.OtrosDatos(valores, dtpAnio3.getYear(), "Casos por zona");
                            frm.setLocationRelativeTo(null);
                            frm.setIconImage(icono);
                            frm.setImagen("/imagenes/fondo.png");
                            frm.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(frm, shape);
                        } else {
                            MensajesInfo p1 = new MensajesInfo('n', "NoCasoA");
                            p1.setLocationRelativeTo(null);
                            p1.setIconImage(icono);
                            p1.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(p1, shape);
                        }
                } else {
                    if (rbtnZona.isSelected() && dtpAnio3.getYear() != -1) {
                        valores = ControladorPrincipal.getInstance().getControladorEstadisticas().casoZonaAnual(dtpAnio3.getYear());
                        if (valores != null) {
                            gui.reportes.OtrosDatos frm = new gui.reportes.OtrosDatos(valores, dtpAnio3.getYear(), "Casos por zona");
                            frm.setLocationRelativeTo(null);
                            frm.setIconImage(icono);
                            frm.setImagen("/imagenes/fondo.png");
                            frm.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(frm, shape);
                        } else {
                            MensajesInfo p1 = new MensajesInfo('n', "NoCasoA");
                            p1.setLocationRelativeTo(null);
                            p1.setIconImage(icono);
                            p1.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(p1, shape);
                        }
                    } else {
                        MensajesInfo p1 = new MensajesInfo('e', "TipoInforme");
                        p1.setLocationRelativeTo(null);
                        p1.setIconImage(icono);
                        p1.setVisible(true);
                        Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                        AWTUtilities.setWindowShape(p1, shape);
                    }
                }
            }
        }
    }//GEN-LAST:event_jButton1ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCerrar;
    private javax.swing.ButtonGroup buttonGroup1;
    private com.toedter.calendar.JYearChooser dtpAnio3;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JRadioButton rbtnCasos;
    private javax.swing.JRadioButton rbtnMotivos;
    private javax.swing.JRadioButton rbtnSexo;
    private javax.swing.JRadioButton rbtnZona;
    // End of variables declaration//GEN-END:variables
}
